package dataSource

import (
	"fmt"
	"github.com/Shopify/sarama"
)

type KafkaIint struct {

}

func (KafkaIint *KafkaIint) NewKafkaInit() sarama.SyncProducer{
	config := sarama.NewConfig()
	config.Producer.RequiredAcks = sarama.WaitForAll
	config.Producer.Partitioner = sarama.NewRandomPartitioner
	config.Producer.Return.Successes = true

	client, err := sarama.NewSyncProducer([]string{"127.0.0.1:9092"}, config)
	if err != nil {
		fmt.Println("producer close, err:", err)
		return nil
	}
	return client
}
